# -*- coding: utf-8 -*-
"""
This file demonstrates two different styles of tests (one doctest and one
unittest). These will both pass when you run "manage.py test".

Replace these with more appropriate tests for your application.
"""

from django.test import TestCase
from django.test.client import Client

class StandardTest(TestCase):

  def test_001_empty_list(self):
    c = Client()
    r = c.get('/list/')
    self.assertEquals(len(r.context['list']), 0)
    self.assertEquals(r.template[0].name, u'list.html')
    self.assertEquals(r.template[1].name, u'base.html')

  def test_002_new_form_auth_required(self):
    c = Client()
    r = c.get('/new_form/')
    self.assertRedirects(r, '/accounts/login/?next=/new_form/')

  def test_003_new_form(self):
    c = Client()
    c.login(username='admin', password='admin')
    r = c.get('/new_form/')
    self.assertEquals(r.template[0].name, u'edit.html')
    self.assertEquals(r.template[1].name, u'base.html')

class SimpleTest(TestCase):

    def testbasic_addition(self):
        """
        Tests that 1 + 1 always equals 2.
        """
        self.failUnlessEqual(1 + 1, 2)


__test__ = {"doctest": """
Another way to test that 1 + 1 is equal to 2.

>>> 1 + 1 == 2
True
"""}

